const express = require('express');
const bodyParser = require('body-parser');

const app = express();

// 使用body-parser中间件
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())

app.get('/user/findById', (req, res) => {

})

app.post('/user/save', (req, res) => {
  console.log(req.body);

  res.send({
    status: 200,
    message: '保存成功',
    data: null,
    timestamp: new Date().getTime()
  })
})

app.put('/user', (req, res) => {
  res.send('修改')
})

app.delete('/user', (req, res) => {
  res.send('删除')
})

app.listen(3000, () => {
  console.log('localhost:3000服务器已开启');
})